import java.util.Scanner;
import java.util.regex.Pattern;

/**
 * @author zhaoqian
 * @create 2021/8/27 16:52
 */
public class test2 {
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        while (in.hasNext()) {
            String str = in.nextLine();
            System.out.println(test(str));
        }
    }
    public static String test(String a){
    int i=0;  //横坐标
    int j=0;  //纵坐标
        String[] split = a.split(";");
        for (String p:split) {
            String regex = "[a-zA-Z]";
            if (p.length()<4){
            String c = String.valueOf(p.charAt(0));
                String s = p.substring(1);
                Pattern pattern= Pattern.compile("[0-9]*");
                 if (pattern.matcher(s).matches()){
                     if (c.matches(regex)){
                         if ("A".equals(c)){
                             String a1 = p.replace("A", "0");
                             Integer value = Integer.valueOf(a1);
                             i=i-value;
                         }
                         if ("D".equals(c)){
                             String a1 = p.replace("D", "0");
                             Integer value = Integer.valueOf(a1);
                             i=i+value;
                         }
                         if ("W".equals(c)){
                             String a1 = p.replace("W", "0");
                             Integer value = Integer.valueOf(a1);
                             j=j+value;
                         }
                         if ("S".equals(c)){
                             String a1 = p.replace("S", "0");
                             int value = Integer.parseInt(a1);
                             j=j-value;
                         }
                         else {
                         }

                     }
                 }


            }
        }
        return i+","+j;
    }
}
